package com.wanmait.deliverymangementsystem.usercontroller;

import com.wanmait.deliverymangementsystem.pojo.Reviews;
import com.wanmait.deliverymangementsystem.service.ReviewsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("user")
public class UserIndexController {
    @Resource
    private ReviewsService reviewsService;
    @RequestMapping("index")
    @ModelAttribute("reviewsList")
    public List<Reviews> index(){
       List<Reviews> reviewsList= reviewsService.findGoodReviews();
        return reviewsList;
    }
    @RequestMapping("logOut")
    public String logOut(HttpSession session){
        session.invalidate();
        return "redirect:/user/login";
    }
    @GetMapping("moreMenu")
    public void moreMenu(){}
}
